package com.learn.jdk8.lambda01;

public class Test {

    private static void t(TestFunctionalInterface functionalInterface){
        System.out.println(functionalInterface.getName());
        functionalInterface.t();
    }

    public static void main(String[] args) {

        //todo 传递实现类
        t(new TestFunctionalInterfaceImpl());

        //todo 匿名内部类
        t(new TestFunctionalInterface(){

            @Override
            public void t() {
                System.out.println("匿名内部类调用");
            }

        });

        //todo lambda
        t(()->{
            System.out.println("lambda调用");
        });

        //todo 当lambda表达式只包含一条语句时，可以省略大括号、return和语句结尾的分号
        t(()-> System.out.println("lambda简化调用"));

        System.out.println(TestFunctionalInterface.getName2());

    }


}
